package com.fr.report.core.barcode;

import com.fr.report.core.barcode.output.AbstractOutput;
import java.util.Arrays;

public class Module
{
  protected final int[] bars;
  private String symbol;

  public Module(int[] paramArrayOfInt)
  {
    this.bars = paramArrayOfInt;
  }

  public String getSymbol()
  {
    return this.symbol;
  }

  public void setSymbol(String paramString)
  {
    this.symbol = paramString;
  }

  public int widthInBars()
  {
    int i = 0;
    for (int j = 0; j < this.bars.length; ++j)
      i += this.bars[j];
    return i;
  }

  protected double draw(AbstractOutput paramAbstractOutput, double paramDouble1, double paramDouble2)
  {
    double d1 = 0.0D;
    for (int i = 0; i < this.bars.length; ++i)
    {
      int j = this.bars[i];
      double d2 = j * paramAbstractOutput.getBarWidth();
      d1 += d2;
      paramAbstractOutput.drawBar((int)paramDouble1, (int)paramDouble2, (int)d2, (int)paramAbstractOutput.getBarHeight(), i % 2 == 0);
      paramDouble1 += d2;
    }
    return d1;
  }

  public boolean equals(Object paramObject)
  {
    if (this == paramObject)
      return true;
    if (!(paramObject instanceof Module))
      return false;
    Module localModule = (Module)paramObject;
    return (Arrays.equals(this.bars, localModule.bars));
  }

  public int hashCode()
  {
    int i = 0;
    for (int j = 0; j < this.bars.length; ++j)
      i += (j + 1) * this.bars[j];
    return i;
  }

  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; i < this.bars.length; ++i)
    {
      if (i > 0)
        localStringBuffer.append(", ");
      localStringBuffer.append(this.bars[i]);
    }
    return localStringBuffer.toString();
  }
}